package com.mit.facade;

import org.apache.log4j.Logger;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.mit.config.AppConfiguration;



public class BeanHelper {
	private static Logger logger = Logger.getLogger(BeanHelper.class);
	private static BeanHelper me;
	private ApplicationContext ctx = null;
	private BeanHelper(){
		ctx = new ClassPathXmlApplicationContext(AppConfiguration.getSpringConfigFiles());
	}
	
	public static BeanHelper getInstance(){
		if(me == null){
			logger.info("New a instance.");
			me = new BeanHelper();
		}
		return me;
	}

	public Object getBean(String beanName){
		return ctx.getBean(beanName);
	}
}
